package actions;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.sound.midi.Sequencer;
import javax.swing.ImageIcon;
import javax.swing.JButton;

public class ActionStop implements ActionListener{

	JButton botaoPlay;
	JButton botaoStop;
	JButton botaoPause;
	Sequencer seq;
	
	public ActionStop(JButton botaoP, JButton botaoS,JButton botaoPa,Sequencer seq) {
		this.botaoPlay = botaoP;
		this.botaoStop = botaoS;
		this.botaoPause = botaoPa;
		this.seq = seq;
	}

	public void actionPerformed(ActionEvent arg0) {
		botaoPlay.setIcon(new ImageIcon("img/play_up.png"));
		botaoStop.setIcon(new ImageIcon("img/stop_down.png"));
		botaoPause.setIcon(new ImageIcon("img/pause_up.png"));
		if(seq != null){
			if(seq.isRunning())
    		seq.stop();
        	seq.setTickPosition(0);
    	}
	}
}